package com.hqd.ch03.test.web.v40;


import com.hqd.ch03.v40.context.stereotype.Controller;
import com.hqd.ch03.v40.web.bind.annotation.RequestMapping;
import com.hqd.ch03.v40.web.bind.annotation.RequestParam;
import com.hqd.ch03.v40.web.ui.Model;

@Controller
public class HelloController {
    // 首页视图
    @RequestMapping("/index")
    public String home(Model model) {
        model.addAttribute("message", "Welcome to the Spring MVC Theme Switcher!");
        return "index";
    }

    // 切换主题视图
    @RequestMapping("/switch-theme")
    public String switchTheme(@RequestParam("theme") String theme, Model model) {
        model.addAttribute("theme", theme);
        return "theme-switch";
    }
}
